package game.module.club.processor;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


import game.common.PlayingRoleMsgProcessor;
import game.entity.PlayingRole;
import game.module.club.logic.ClubManager;
import lion.common.MsgCodeAnn;
import lion.netty4.message.MyRequestMessage;
import lion.netty4.message.RequestMessageRaw;
import lion.netty4.message.RequestProtoMessage;
import lua.LuaMessageHall.C2SClubName;
import lua.LuaMessageHall.S2CClubName;

/**
 * @author: Pomelo.Lee
 * @date: 2017年8月29日 下午1:56:24
 */
@MsgCodeAnn(msgcode = C2SClubName.id, accessLimit = 500)
public class ClubNameProcessor extends PlayingRoleMsgProcessor {

	private static Logger logger = LoggerFactory.getLogger(ClubNameProcessor.class);

	@Override
	public void process(PlayingRole playingRole, RequestMessageRaw requestMessage) throws Exception {
		int playerId = playingRole.getId();
		logger.info("player random club name,playerId={}", playerId);

		String clubName = ClubManager.getInstance().randomClubName();
		
		S2CClubName respMsg = new S2CClubName();
		respMsg.clubname = clubName;
		playingRole.writeAndFlush(respMsg.build(playingRole.alloc()));
	}

	@Override
	public void processProto(PlayingRole playingRole, RequestProtoMessage request) throws Exception {
		// TODO Auto-generated method stub

	}

	@Override
	public void processWebsocket(PlayingRole playingRole, MyRequestMessage request) throws Exception {
		// TODO Auto-generated method stub

	}

}
